package com.zzyl;

import com.huaweicloud.sdk.iotda.v5.IoTDAClient;
import com.huaweicloud.sdk.iotda.v5.model.ListProductsRequest;
import com.huaweicloud.sdk.iotda.v5.model.ListProductsResponse;
import com.huaweicloud.sdk.iotda.v5.model.ProductSummary;
import com.zzyl.nursing.service.WechatService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;

import java.util.List;

@SpringBootTest
public class redisTxts {
    @Autowired
    private RedisTemplate redisTemplate;
    @Test
    public void taxt1(){
        redisTemplate.opsForValue().set("name","zzyl");
        System.out.println(redisTemplate.opsForValue().get("name"));
        redisTemplate.opsForValue().set("name","zhangsan");
        System.out.println(redisTemplate.opsForValue().get("name"));
    }

    @Autowired
    private WechatService wechatService;

    @Test
    public void testGetOpenid() {
        String openid = wechatService.getOpenId("0e3IEDkl2Ee12g4wALnl2uPrji0IEDk3");
        System.out.println(openid);//o3CsK6_C6f4WP9b0AxXNJOkc6q9Q
    }

    @Test
    public void testGetPhone() {
        String phone = wechatService.getPhone("28a5b922925d225ea43722be53ff8abd27e7be7f814ca54977aeb932762fcb54");
        System.out.println(phone);
    }

        @Autowired
        private IoTDAClient client;

        /**
         * 查询公共实例下的所有产品
         * @throws Exception
         */
        @Test
        public void selectProduceList() throws Exception {
            ListProductsRequest listProductsRequest = new ListProductsRequest();
            listProductsRequest.setLimit(50);
            ListProductsResponse response = client.listProducts(listProductsRequest);
            List<ProductSummary> products = response.getProducts();
            System.out.println(products);
        }

    }


